<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<html>

	<head>
		<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
		<link title="David R. Hanson" href="http://drh.home.dyndns.org" rev="made">
		<link href="style.css" rel="stylesheet" type="text/css" media="all">
		<title>Errata for C Interfaces and Implementations, 2/p</title>
	</head>

	<body>
		<h1>Errata: Second and Third Printings</h1>
		<p>Corrections to second (Jan. 1997) and third (June 2001) printings of <cite>C Interfaces and Implementations: Techniques for Creating Reusable Software</cite> (Addison-Wesley Professional Computing Series, 1997, ISBN 0-201-49841-3). In the list below, line +<em>n</em> and line -<em>n</em> refer to the <em>n</em>th line from the top and bottom of the indicated page.</p>
		<p><strong>Page 168, lines -13..-8:</strong> Change to</p>
		<blockquote>
			<pre>if (length == 0)
	FREE(array-&gt;array);
else if (array-&gt;length == 0)
	array-&gt;array = ALLOC(length*array-&gt;size);
else
	RESIZE(array-&gt;array, length*array-&gt;size);</pre>
		</blockquote>
		<p>(This change should also be applied to page 168, lines -11..-8 in the first printing.)</p>
		<p>The errors below also appear in the first printing.</p>
		<p><strong>Page 48, line 5:</strong> <code>char *reason;</code> <img src="images/rightarrow.gif" height="11" width="17" align="BOTTOM"> <code>const char *reason;</code></p>
		<p><strong>Page 49, line -11..-10:</strong> Change &quot;next EXCEPT, ELSE, FINALLY or END_TRY&quot; to &quot;corresponding END_TRY&quot;.</p>
		<p><strong>Page 61, line 6:</strong> <u>=</u> <img src="images/rightarrow.gif" height="11" width="17" align="BOTTOM"> +<u>=</u></p>
		<p><strong>Page 68, line -12:</strong> <code>&gt;=</code> <img src="images/rightarrow.gif" height="11" width="17" align="BOTTOM"> <code>&gt;</code></p>
		<p><strong>Page 84, line -10:</strong> Change to</p>
		<blockquote>
			<pre>#define NALLOC ((4096 + sizeof (union align) - 1)/ \
	(sizeof (union align)))*(sizeof (union align))</pre>
		</blockquote>
		<p><strong>Page 169, lines 9 and 12:</strong> Change to</p>
		<blockquote>
			<pre>memcpy(copy-&gt;array, array-&gt;array, array-&gt;length*array-&gt;size);
memcpy(copy-&gt;array, array-&gt;array, copy-&gt;length*array-&gt;size);</pre>
		</blockquote>
		<p><strong>Page 241, line -8:</strong> Incidently <img src="images/rightarrow.gif" height="11" width="17" align="BOTTOM"> Incidentally</p>
		<p><strong>Page 249, line 1:</strong> <code>char *suffix</code> <img src="images/rightarrow.gif" height="11" width="17" align="BOTTOM"> <code>const char *suffix</code></p>
		<p><strong>Page 274, line 12:</strong> 127 <img src="images/rightarrow.gif" height="11" width="17" align="BOTTOM"> 128</p>
		<p><strong>Page 277, line -2:</strong> <code>127</code> <img src="images/rightarrow.gif" height="11" width="17" align="BOTTOM"> <code>128</code></p>
		<p><strong>Page 284, lines 5 and -7:</strong> Change to</p>
		<blockquote>
			<pre>map[(unsigned char)from-&gt;str[k]] = to-&gt;str[k];
*p++ = map[(unsigned char)s.str[i]];</pre>
		</blockquote>
		<p><strong>Page 352, line -11:</strong> <code>x-&gt;sign == 1</code> <img src="images/rightarrow.gif" height="11" width="17" align="BOTTOM"> <code>x-&gt;sign == -1</code></p>
		<p><strong>Page 358, line -2:</strong> initalized <img src="images/rightarrow.gif" height="11" width="17" align="BOTTOM"> initialized</p>
		<p><strong>Page 366, line 2:</strong> Add</p>
		<blockquote>
			<code><b>f</b></code><img src="images/dot_clear.gif" height="1" width="18">print all the values on the stack from the top down</pre></blockquote>
		<p><strong>Page 367, line -6:</strong> <code>MP_T</code> <img src="images/rightarrow.gif" height="11" width="17" align="BOTTOM"> <code>volatile MP_T</code></p>
		<p><strong>Page 370, line -11:</strong> <code>char *fmt;</code> <img src="images/rightarrow.gif" height="11" width="17" align="BOTTOM"> <code>const char *fmt;</code></p>
		<p><strong>Page 372, line 3:</strong> <code>--n &gt; 0</code> <img src="images/rightarrow.gif" height="11" width="17" align="BOTTOM"> <code>--n &gt;= 0</code></p>
		<p><strong>Page 416, lines 15 and 16:</strong> Change to</p>
		<blockquote>
			<pre>Sem_wait(&amp;mutex);
TRY</pre>
		</blockquote>
		<p><strong>Page 417, lines 11 and 12:</strong> Change to</p>
		<blockquote>
			<pre>Sem_wait(&amp;tab.mutex);
TRY</pre>
		</blockquote>
		<p><strong>Page 420, line -7:</strong> Change to</p>
		<blockquote>
			<pre>i++; while (i &lt; j &amp;&amp; a[i] &lt; v) i++;</pre>
		</blockquote>
		<p><strong>Page 493, line -11:</strong> returns <code>preempt</code> or zero <img src="images/rightarrow.gif" height="11" width="17" align="BOTTOM"> returns one or zero</p>
		<p><a href="1.html">First printing corrections.</a></p>
		<hr>
		<address><a href="http://drh.home.dyndns.org">David Hanson</a><br>
			$Revision: 171 $ $Date: 2007-04-14 17:52:26 +0000 (Sat, 14 Apr 2007) $</address>
	</body>

</html>